<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:c="http://java.sun.com/jsp/jstl/core"
	xmlns:p="http://primefaces.org/ui" >

	<h:form id="frm1">
		<p:growl id="msgs1" showDetail="true" />
		<p:panel id="custPanel" header="客户基本信息维护"
			style="margin-bottom:5px"
			footer="客户基本信息维护">
			<h:panelGrid columns="8" cellspacing="10">								
				<p:outputLabel value="客户ID" />
				<p:inputText  value="#{customerController.customer.id}" required="true" requiredMessage="客户编号必须输入"/>
				<p:outputLabel value="客户名称" />
				<p:inputText value="#{customerController.customer.name}" required="true" requiredMessage="客户名称必须输入"/>
				<p:outputLabel value="客户地址" />
				<p:inputText value="#{customerController.customer.address}" />	
				<p:outputLabel value="客户所在城市" />
				<p:inputText value="#{customerController.customer.city}" />	
				<p:outputLabel value="联系人" />
				<p:inputText value="#{customerController.customer.contactor}" />	
				<p:outputLabel value="联系电话" />
				<p:inputText value="#{customerController.customer.phone}" />	
				<p:outputLabel value="备注" />
				<p:inputText value="#{customerController.customer.remarks}" />	
					
			</h:panelGrid>
			<h:panelGrid columns="4" cellspacing="10">			
				<p:commandButton value="新增客户提交"	icon="ui-icon-check" 
					action="#{customerController.addAction}" update=":tabview:frm1">
				</p:commandButton>	
			</h:panelGrid>
			<p:dataTable id="rdt" var="row" resizableColumns="true" liveResize="true" 
				value="#{customerController.vo}" editable="true"
				style="margin-bottom:20px" >
				
				<p:ajax event="rowEdit" listener="#{customerController.onRowEdit}"
					update=":tabview:frm1:msgs1" />
				<p:ajax event="rowEditCancel"	listener="#{customerController.onRowCancel}"
					update=":tabview:frm1:msgs1" />

				<p:column headerText="客户ID" sortBy="#{row.id}">
					<p:cellEditor>
						<f:facet name="output">
							<h:outputText value="#{row.id}" />
						</f:facet>
						<f:facet name="input">
							<h:outputText id="modelInput" value="#{row.id}"
								style="width:100%" />
						</f:facet>
					</p:cellEditor>
				</p:column>
				<p:column headerText="客户名称">
					<p:cellEditor>
						<f:facet name="output">
							<h:outputText value="#{row.name}" />
						</f:facet>
						<f:facet name="input">
							<p:inputText value="#{row.name}" style="width:100%"
								label="客户名称" />
						</f:facet>
					</p:cellEditor>
				</p:column>
				<p:column headerText="客户地址">
					<p:cellEditor>
						<f:facet name="output">
							<h:outputText value="#{row.address}" />
						</f:facet>
						<f:facet name="input">
							<p:inputText value="#{row.address}" style="width:100%"
								label="客户地址" />
						</f:facet>
					</p:cellEditor>
				</p:column>
				<p:column headerText="客户城市">
					<p:cellEditor>
						<f:facet name="output">
							<h:outputText value="#{row.city}" />
						</f:facet>
						<f:facet name="input">
							<p:inputText value="#{row.city}" style="width:100%"
								label="客户城市" />
						</f:facet>
					</p:cellEditor>
				</p:column>
				<p:column headerText="联系人">
					<p:cellEditor>
						<f:facet name="output">
							<h:outputText value="#{row.contactor}" />
						</f:facet>
						<f:facet name="input">
							<p:inputText value="#{row.contactor}" style="width:100%"
								label="联系人" />
						</f:facet>
					</p:cellEditor>
				</p:column>
				<p:column headerText="联系电话">
					<p:cellEditor>
						<f:facet name="output">
							<h:outputText value="#{row.phone}" />
						</f:facet>
						<f:facet name="input">
							<p:inputText value="#{row.phone}" style="width:100%"
								label="联系电话" />
						</f:facet>
					</p:cellEditor>
				</p:column>
				<p:column headerText="备注">
					<p:cellEditor>
						<f:facet name="output">
							<h:outputText value="#{row.remarks}" />
						</f:facet>
						<f:facet name="input">
							<p:inputText value="#{row.remarks}" style="width:100%"
								label="备注" />
						</f:facet>
					</p:cellEditor>
				</p:column>

				<p:column style="width:32px">
					<p:rowEditor />
				</p:column>
			</p:dataTable>

		</p:panel>
	</h:form>
				
</ui:composition>

